<?php
/*
 *author:Yangligao
 *Date:2013-9-28
 */
require '../../Config.php';
$flag = $_GET['flag'];

$advModel = new AdvModel();
if($flag == 'display'){
	
	$advData = $advModel->adv_select();
	
	//这里准备一个标志，标志广告是否已过期;
	for($i=0;$i<count($advData);$i++){
		if(time() - $advData[$i]['adv_endtime'] >= 0){
			
			$advData[$i]['timeflag'] = 1;
		}else{
			
			$advData[$i]['timeflag'] = 0;
		}
}
	
	$smarty->assign('advData',$advData);
	$smarty->display('Admin/AdvM/advm.html');
}else if($flag == 'advdelete'){
	$arr['adv_id'] = $_GET['id'];
	$res = $advModel->adv_delete($arr);
	if($res){
		jump('操作成功！', $_SERVER['HTTP_REFERER']);
	}else{
		alertInfo('操作失败！', $_SERVER['HTTP_REFERER']);
	}
}
?>
